package cn.cheln.support.images;

import android.content.Context;
import cn.cheln.explorer.beans.FileInfo;
import java.io.File;
import java.io.FilenameFilter;
import java.util.HashMap;

public class FileCategoryHelper
{
  private static String APK_EXT = "apk";
  public static final int COLUMN_DATE = 3;
  public static final int COLUMN_ID = 0;
  public static final int COLUMN_PATH = 1;
  public static final int COLUMN_SIZE = 2;
  private static String THEME_EXT = "lwt";
  private static String[] ZIP_EXTS = { "zip", "rar" };
  public static HashMap<FileCategory, Integer> categoryNames;
  public static HashMap<FileCategory, FilenameExtFilter> filters = new HashMap();
  public static FileCategory[] sCategories;
  private FileCategory mCategory;
  private HashMap<FileCategory, CategoryInfo> mCategoryInfo = new HashMap();
  private Context mContext;

  static
  {
    categoryNames = new HashMap();
    FileCategory[] arrayOfFileCategory = new FileCategory[8];
    arrayOfFileCategory[0] = FileCategory.Music;
    arrayOfFileCategory[1] = FileCategory.Video;
    arrayOfFileCategory[2] = FileCategory.Picture;
    arrayOfFileCategory[3] = FileCategory.Theme;
    arrayOfFileCategory[4] = FileCategory.Doc;
    arrayOfFileCategory[5] = FileCategory.Zip;
    arrayOfFileCategory[6] = FileCategory.Apk;
    arrayOfFileCategory[7] = FileCategory.NoType;
    sCategories = arrayOfFileCategory;
  }

  public FileCategoryHelper(Context paramContext)
  {
    this.mContext = paramContext;
    this.mCategory = FileCategory.All;
  }

  public static FileTypeInfo getCategoryFromPath(String paramString)
  {
    String str;
    if (new File(paramString).isDirectory())
      return new FileTypeInfo(FileCategory.Folder, FileInfo.iconDir, null);
    if (paramString == null);
    for (int i = -1; ; i = paramString.lastIndexOf(46))
    {
      if (i <= -1)
        break label108;
      str = paramString.substring(i + 1);
      if (!(str.equalsIgnoreCase(APK_EXT)))
        break;
      return new FileTypeInfo(FileCategory.Apk, FileInfo.iconPackage, null);
    }
    if (str.equalsIgnoreCase(THEME_EXT))
      return new FileTypeInfo(FileCategory.Theme, FileInfo.iconTheme, null);
    label108: return MimeUtil.isTypeFromMime(paramString, FileTypeInfo.typeInfos);
  }

  public CategoryInfo getCategoryInfo(FileCategory paramFileCategory)
  {
    if (this.mCategoryInfo.containsKey(paramFileCategory))
      return ((CategoryInfo)this.mCategoryInfo.get(paramFileCategory));
    CategoryInfo localCategoryInfo = new CategoryInfo();
    this.mCategoryInfo.put(paramFileCategory, localCategoryInfo);
    return localCategoryInfo;
  }

  public HashMap<FileCategory, CategoryInfo> getCategoryInfos()
  {
    return this.mCategoryInfo;
  }

  public FileCategory getCurCategory()
  {
    return this.mCategory;
  }

  public int getCurCategoryNameResId()
  {
    return ((Integer)categoryNames.get(this.mCategory)).intValue();
  }

  public FilenameFilter getFilter()
  {
    return ((FilenameFilter)filters.get(this.mCategory));
  }

  public void setCurCategory(FileCategory paramFileCategory)
  {
    this.mCategory = paramFileCategory;
  }

  public void setCustomCategory(String[] paramArrayOfString)
  {
    this.mCategory = FileCategory.Custom;
    if (filters.containsKey(FileCategory.Custom))
      filters.remove(FileCategory.Custom);
    filters.put(FileCategory.Custom, new FilenameExtFilter(paramArrayOfString));
  }

  public class CategoryInfo
  {
    public long count;
    public long size;
  }

  public static enum FileCategory
  {
    static
    {
      Picture = new FileCategory("Picture", 3);
      Theme = new FileCategory("Theme", 4);
      Doc = new FileCategory("Doc", 5);
      Zip = new FileCategory("Zip", 6);
      Apk = new FileCategory("Apk", 7);
      Custom = new FileCategory("Custom", 8);
      NoType = new FileCategory("NoType", 9);
      Favorite = new FileCategory("Favorite", 10);
      NoRecorded = new FileCategory("NoRecorded", 11);
      Folder = new FileCategory("Folder", 12);
      FileCategory[] arrayOfFileCategory = new FileCategory[13];
      arrayOfFileCategory[0] = All;
      arrayOfFileCategory[1] = Music;
      arrayOfFileCategory[2] = Video;
      arrayOfFileCategory[3] = Picture;
      arrayOfFileCategory[4] = Theme;
      arrayOfFileCategory[5] = Doc;
      arrayOfFileCategory[6] = Zip;
      arrayOfFileCategory[7] = Apk;
      arrayOfFileCategory[8] = Custom;
      arrayOfFileCategory[9] = NoType;
      arrayOfFileCategory[10] = Favorite;
      arrayOfFileCategory[11] = NoRecorded;
      arrayOfFileCategory[12] = Folder;
      ENUM$VALUES = arrayOfFileCategory;
    }
  }
}

/* Location:           H:\360云盘\lewa_explorer_3.0\bin\FileApp_orig_dex2jar.jar
 * Qualified Name:     cn.cheln.support.images.FileCategoryHelper
 * JD-Core Version:    0.5.2
 */